/*
 * Copyright 2018-9-30 20:11:44 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.scp.erp.core.impl;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lap.scd.commons.core.exception.ManagerException;
import com.lap.scd.commons.page.Page;
import com.lap.scp.erp.core.SuppilerManager;
import com.lap.scp.erp.dal.SuppilerDAO;
import com.lap.scp.erp.domain.SuppilerDO;
import com.lap.scp.erp.query.SuppilerQueryVO;

/**
 * <pre>
 * 供应商信息，记录供应商信息，供应商的描述，加入时间等业务代码默认实现类，这里提供最小元素原子操作，所以尽量少在该类中做流程代码。
 * 业务流程代码应该写在AO中。
 * </pre>
 * 
 * @author 劳水生 Exp
 * @Date 2018-9-30 20:11:44
 * @since 2.0.0
 */
@Service("suppilerManager")
public class DefaultSuppilerManager implements SuppilerManager {
	/**
	 * 供应商信息，记录供应商信息，供应商的描述，加入时间等数据操作对象
	 */
	@Resource
	private SuppilerDAO suppilerDAO;

	@Override
	public void insertSuppiler(SuppilerDO suppilerDO) throws ManagerException {
		suppilerDAO.insertSuppiler(suppilerDO);
	}

	@Override
	public int deleteById(Integer suppilerId) throws ManagerException {
		return suppilerDAO.deleteById(suppilerId);
	}

	@Override
	public SuppilerDO queryById(Integer suppilerId) throws ManagerException {
		return suppilerDAO.queryById(suppilerId);
	}

	@Override
	public List<SuppilerDO> queryPage(Page page, SuppilerQueryVO queryVO) throws ManagerException {
		int count = suppilerDAO.countPage(queryVO);
		if (count == 0) {
			return Collections.emptyList();
		} else {
			page.setTotalItem(count);
			return suppilerDAO.queryPage(page, queryVO);
		}
	}

	@Override
	public int updateSuppiler(SuppilerDO suppilerDO) throws ManagerException {
		return suppilerDAO.updateSuppiler(suppilerDO);
	}

	@Override
	public List<SuppilerDO> queryList() throws ManagerException {
		return suppilerDAO.queryList();
	}

}
